package com.ty.common.core.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 异常枚举类
 * @Author: TangYuan
 * @Date: 2025/8/18 16:57
 */
@Getter
@AllArgsConstructor
public enum CommonResponseEnum implements ResponseEnumTemplate<CommonResponseEnum> {


    // 认证授权相关异常 (100-199)
    VALID_ERROR(100, "参数校验异常"),
    BAD_CREDENTIALS(101, "账户不存在或密码错误"),
    ACCOUNT_LOCKED(102, "密码错误次数过多，账户锁定！"),
    INVALID_CLIENT(103, "无效的ClientId"),
    CLIENT_DISABLED(104, "Client认证已禁用"),
    TOKEN_INVALID(105, "无效Token"),
    USER_INVALID(106, "无效用户"),
    USER_DISABLED(107, "用户被禁用"),
    PERMISSION_DENIED(108, "抱歉，您目前无权执行此操作，请联系管理员获取相应权限。"),
    WEBSOCKET_ERROR(109, "WebSocket消息发送异常"),
    TOO_MANY_REQUESTS(110, "您的请求过于频繁，请稍后再试！"),

    // 通用数据相关异常 (1000-1099)
    ID_INVALID(1000, "无效ID"),
    ALREADY_EXISTS(1001, "已存在"),
    NOT_FOUND(1002, "不存在"),
    FILE_NOT_FOUND(1003, "文件不存在"),
    FILE_TYPE_ERROR(1004, "上传文件类型错误"),
    FILE_SIZE_ERROR(1005, "上传文件大小不能超过10MB"),
    FILE_UPLOAD_ERROR(1006, "上传文件失败"),
    USERNAME_EXISTS(1007, "用户名已存在"),
    DATA_INVALID(1008, "无效的数据"),
    EXCEL_IMPORT_ERROR(1009, "Excel导入失败"),
    CAPTCHA_MISSING(1010, "验证参数缺失"),
    CAPTCHA_EXPIRED(1011, "验证码失效，请重新获取"),
    CAPTCHA_FAILED(1012, "验证失败"),
    CAPTCHA_LIMIT(1013, "验证码请求已达到最大次数"),
    BACKGROUND_NOT_FOUND(1014, "背景图片不存在"),

    UNKNOWN(9999, "未知异常");

    /**
     * 返回码
     */
    private final int code;

    /**
     * 返回消息
     */
    private final String message;

    @Override
    public ErrorPrefixEnum getCodePrefixEnum() {
        return ErrorPrefixEnum.COMMON;
    }
}